package com.example.designmodel.activity

import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.android.baselibrary.arouter.ArouterContains
import com.android.baselibrary.base.BaseActivity
import com.android.baselibrary.base.BasePath
import com.example.designmodel.R
import com.example.designmodel.adapter.DesignModelAdapter
import com.example.designmodel.databinding.DmActivityMainBinding
import com.example.designmodel.router.DesignRouter


@Route(path = ArouterContains.DESIGN_MODEL)
class DesignModelMainActivity : BaseActivity<DmActivityMainBinding>() {
    @JvmField
    @Autowired
    var name:String =""
    private val modelAdapter by lazy {
        DesignModelAdapter()
    }

    override fun getLayoutId(): Int = R.layout.dm_activity_main

    override fun initView() {
        mBinding.recycleView.apply {
            adapter = modelAdapter
        }
        modelAdapter.setData(mList as MutableList<BasePath>)
    }

    override fun initListener() {
       modelAdapter.setOnItemClickListener { data, _ ->
           ARouter.getInstance().build(data.path).navigation()
       }
    }

    private val mList:List<BasePath> by lazy {
        listOf(BasePath("责任链模式",DesignRouter.DESIGN_CHAIN))
    }
}